<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:t="http://myfaces.apache.org/tomahawk"
	template="../../layout/commonLayout.xhtml">
	<ui:define name="head">
                BIDI BIDI
                </ui:define>
	<ui:define name="content">
		<p:outputPanel id="mainPanel">
			<p:messages globalOnly="true" />
			<p:panel id="panel1"
				rendered="#{publishXMLBean.state == 0 or publishXMLBean.state == 1 or publishXMLBean.state == 2 or publishXMLBean.state == 3}">
				<h:form id="publishForm">
					<p:panel id="publishPanel">
						<h:outputLabel style="font-weight:bold;color:blue">Publish Name : </h:outputLabel>
						<h:outputText value=" " />
						<p:inputText id="publishName"
							value="#{publishXMLBean.publishName}" size="30" />
						<p:message for="publishName" id="publishNameMessage" />

					</p:panel>
					<p:panel>
						<h:panelGrid columns="4">
							<h:outputLabel style="font-weight:bold;color:blue">XML Location : </h:outputLabel>
							<h:outputText value=" " />
							<p:inputText id="xmlLocation"
								value="#{publishXMLBean.xmlLocation}" size="30" />
							<p:fileUpload
								fileUploadListener="#{publishXMLBean.handleFileUpload}"
								update="xmlLocation" />
							<p:message for="xmlLocation" id="xmlLocationMessage" />
						</h:panelGrid>
					</p:panel>
					<p:panel>
						<h:outputLabel style="font-weight:bold;color:blue">Request Path : </h:outputLabel>
						<h:outputText value=" /publish/ " />
						<p:inputText id="requestPath"
							value="#{publishXMLBean.requestPath}" size="30" />
						<p:message for="requestPath" id="requestPathMessage" />
					</p:panel>
					<p:panel>
						<p:commandButton action="#{publishXMLBean.checkXML}" value="Next"
							update="mainPanel" />
					</p:panel>
				</h:form>
				<p:dialog rendered="#{publishXMLBean.state == 2}" visible="true"
					closeOnEscape="false" onCloseUpdate="mainPanel" draggable="false"
					modal="true" resizable="false" widgetVar="sslDialog" width="640">
					<p:panel>
						<h:outputLabel>This certificate is not in truststore. Do you want to add?</h:outputLabel>
					</p:panel>
					<p:outputPanel>
						<h:outputLabel value="Issued To : "
							style="font-weight:bold;color:blue" />
						<h:outputLabel value="#{publishXMLBean.certificateInfo.issuedTo}" />
						<br />
						<h:outputLabel value="Issued By : "
							style="font-weight:bold;color:blue" />
						<h:outputLabel value="#{publishXMLBean.certificateInfo.issuedBy}" />
						<br />
						<h:outputLabel value="Valid From "
							style="font-weight:bold;color:blue" />
						<h:outputLabel
							value="#{publishBasicBean.certificateInfo.notBefore}" />
						<h:outputLabel value=" To " style="font-weight:bold;color:blue" />
						<h:outputLabel value="#{publishXMLBean.certificateInfo.notAfter}" />
						<br />
					</p:outputPanel>
					<p:panel>
						<h:form>
							<p:commandButton
								action="#{publishXMLBean.addCertificaToTrustStore}" value="Yes"
								oncomplete="sslDialog.hide()" />
							<p:commandButton action="#{publishXMLBean.cancelAddCertificate}"
								value="No" oncomplete="sslDialog.hide()" />
						</h:form>
					</p:panel>
				</p:dialog>
				<p:dialog rendered="#{publishXMLBean.state == 3}" visible="true"
					closeOnEscape="false" onCloseUpdate="mainPanel" draggable="false"
					modal="true" resizable="false" widgetVar="basicAuthDialog"
					width="640">
					<p:panel>
						<h:outputLabel>You must enter valid password to enter this resource.</h:outputLabel>
					</p:panel>
					<h:form>
						<p:outputPanel>
							<h:outputLabel value="Username : "
								style="font-weight:bold;color:blue" />
							<p:inputText value="#{publishXMLBean.username}" size="30" />
							<br />
							<h:outputLabel value="Password : "
								style="font-weight:bold;color:blue" />
							<p:password value="#{publishXMLBean.password}" size="30" />
							<br />
						</p:outputPanel>
						<p:panel>
							<p:commandButton action="#{publishXMLBean.basicAuthCheckURL}"
								update="mainPanel" value="Yes"
								oncomplete="basicAuthDialog.hide()" />
							<p:commandButton type="button" value="Cancel"
								oncomplete="basicAuthDialog.hide()" />
						</p:panel>
					</h:form>
				</p:dialog>
			</p:panel>
			<p:panel id="panel5" rendered="#{publishXMLBean.state == 4}">
			<h:inputTextarea value="#{publishXMLBean.contentString}" readonly="true" rows="20" cols="60" style="overflow-x:scroll;word-wrap:auto"/>
				<h:form>
					<p:panel>
						<p:commandButton action="#{publishXMLBean.setConfiguration}"
							value="Finish" update="mainPanel" />
					</p:panel>
				</h:form>
			</p:panel>
		</p:outputPanel>
	</ui:define>
</ui:composition>